package com.travelexp;

import java.util.ArrayList;

import android.content.Context;
import android.graphics.drawable.Drawable;
import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.OverlayItem;

public class MapItemizedOverlay extends ItemizedOverlay{
	private ArrayList<OverlayItem> mapOverlays;
	private Context myContext;
	
	public MapItemizedOverlay(Drawable defaultMarker, Context context) {
		 super(boundCenterBottom(defaultMarker));
		 myContext = context;
		mapOverlays = new ArrayList<OverlayItem>();
	}

	public MapItemizedOverlay(Drawable defaultMarker) {
		super(boundCenterBottom(defaultMarker));
		mapOverlays = new ArrayList<OverlayItem>();
	}

	// Add items
	public void addOverlay(OverlayItem overlay) {
	    mapOverlays.add(overlay);
	    populate();
	}
	
	
	@Override
	protected OverlayItem createItem(int itemIndex) {
		// Will just return the required item 
		return mapOverlays.get(itemIndex);
	}

	@Override
	public int size() {
		// Simply returns the number of items
		return mapOverlays.size();
	}

	
}
